#include "IniProgram.h"
#include <unistd.h>
#include <iostream>
#include <chrono> // 添加这行
using namespace std;

Container *test = nullptr;
Container *test1 = nullptr;
Container *test2 = nullptr;

void t111()
{
    cout << "111" << endl;
}

int main()
{
    test = new Container();
    test->set_background_color(0x00ff0000);
    test->set_Visible();
    test->set_Event_Type(CLICK);
    manager.add(test);
    manager.set_top(test);
    test1 = new Container(test, 200, 200);
    test1->set_Visible();
    test1->align(CENTER);
    test1->set_Event_Type(LONG_PRESS);
    test1->set_background_color(0x000000ff);
    test1->set_Event(t111);

    test2 = new Container(test1, 50, 50);
    test2->set_Visible();
    test2->align(CENTER);
    test2->set_Event_Type(CLICK);
    test2->set_background_color(0x00ffff00);



    
    while (1)
    {
        if (!manager.hasTop())
            continue;

        manager.upadta_top();
        lcd.set_store(manager.get_top());

        // 适当休眠，避免过度占用CPU
        usleep(1000); // 1ms
    }
    return 0;
}